﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace StoreWeb.system.purchaseManage
{
    public partial class purchaseDetail : System.Web.UI.Page
    {
        //BLL.Role role = new BLL.Role() ;
        BLL.PurchaseDetail bll = new BLL.PurchaseDetail();
        BLL.PurchaseMain bll2 = new BLL.PurchaseMain();
        public decimal? pricesum;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                hidid.Value = Request.QueryString["id"];
                hidwhere.Value = " purchaseMainid=" + hidid.Value + " ";
                bindData(hidwhere.Value);

                pricesum=bll2.GetModel(Convert.ToInt32(hidid.Value)).pricesum;

                //if (!string.IsNullOrEmpty(hidid.Value))
                //{
                //    Model.Message ne = message.GetModel(Convert.ToInt32(hidid.Value));
                //    ddluser.SelectedValue = ne.userid.ToString();
                //    //smscontent.Value = ne.smscontent;
                //    scontent.Text = ne.smscontent;


                //}
               
                //if (!string.IsNullOrEmpty(hidid.Value))
                //{
                //    Model.DealersManage ne = userdealers.GetModel(Convert.ToInt32(hidid.Value));
                //    username.Value = ne.username;
                //    mobile.Value = ne.mobile;
                //    s_province.Value = ne.s_province;
                //    s_city.Value = ne.s_city;
                //    s_county.Value = ne.s_county;
                //    description.Text = ne.description;
                //    ddldealersgrade.SelectedValue = ne.dealersgrade.ToString();
                //}
            }
        }

        void bindData(string where)
        {
            Repeater1.DataSource = bll.GetList(where);
            Repeater1.DataBind();
        }
        protected void AspNetPager1_PageChanged(object src, EventArgs e)
        {
            bindData(hidwhere.Value);
        }

        protected void btnserach_Click(object sender, EventArgs e)
        {
            //string[] proSub = Request.Form.GetValues("s_province");
            //string pro1 = proSub[s_province.SelectedIndex];

            //string[] proSub2 = Request.Form.GetValues("s_city");
            //string pro2 = proSub2[s_city.SelectedIndex];

            //string[] proSub3 = Request.Form.GetValues("s_county");
            //string pro3 = proSub3[s_county.SelectedIndex];

            //string where = " purchaseMainid=" + hidid.Value + " ";
            //if (name.Value != null && !string.IsNullOrEmpty(name.Value))
            //{
            //    where += " and customername like '%" + name.Value + "%'";
            //}
            //hidwhere.Value = where;
            //bindData(hidwhere.Value);
        }

        
    }
}